The present invention relates to a disk drive such as a hard disk drive, and also a method of performing, in a disk drive, commands issued from a host system.
A hard disk drive (HDD) has a head, an encoder and a decoder. The head can write data on a disk-shaped recording medium (hereinafter referred to as xe2x80x9cdiskxe2x80x9d) in accordance with a write command supplied from a host system (e.g., a digital apparatus such as a personal computer). The head can read data from the disk in accordance with a read command supplied from the host system. To enable the head to write data on the disk, the encoder converts the data transferred from the host system, to write data than can be magnetically recorded on the disk. In the data-reading operation, the decoder decodes the data read by the head from the disk, to the original data.
The HDD comprises a disk controller (HDC) and a buffer memory (i.e., a DRAM). The HDC has a host interface for controlling the transfer of the write command, the read command, the write data (i.e., data to be written on the disk), and the read data (i.e., data read from the disk), between the HDD and the host system. The HDC controls the buffer memory, which is also known as xe2x80x9csector buffer.xe2x80x9d Controlled by the HDC, the buffer memory temporarily stores the write data transferred from the host system or the read data output from the decoder.
In the data-reading operation, the HDC starts transferring the read data when the sector buffer accumulates a predetermined amount of data (usually, one sector of data). For example, an HDC having an IDE (Intelligent Drive Electronics) interface starts transferring the read data when the sector buffer accumulates at least 512 bytes of data, which is one sector of data. The HDC has a sector counter that detects the amount of data stored in the sector buffer. The count of the sector counter increases by one every time one sector of data (i.e., 512 bytes) is read from the disk and stored into the sector buffer.
Usually, the data-transferring speed at which data is read from the disk and store it into the sector buffer is lower than the speed at which data is read from the sector buffer and transfer it to the host system. Hence, when one sector of data is transferred from the sector buffer to the host system, the next sector of data to be transferred to the host system may not be stored into the sector buffer. If this happens, the host system needs to wait until the next sector of data is stored into the sector buffer in the HDD.
In recent years, HDDs are used not only in computers, but also as digital media for recording digital data such as audio data and video data (including still pictures). Digital data is continuous data, such as a stream of images, and is processed in large units. An HDD must therefore read a prescribed amount of data from the disk and transfer it to the host system within a predetermined time during the data-reproducing operation. The host system processes, for example, video data transferred from the HDD, so that the data may be displayed on the screen of a display. Generally, the speed of processing the data transferred from the HDD is lower than the speed of transferring the data from the HDD to the host system.
Assume that the host system issues a read command to the HDC provided in the HDD, at regular intervals T, or at time IS0, time IS1, time IS2 and time IS3, as is illustrated in FIG. 22A. In response to the read command, the HDC transfers the desired read data to the host system for a time DT as shown in FIG. 22B, in response to the read command. In most cases, the desired data is stored in the sector buffer, and the HDC reads the transmits the data from the sector buffer and transfers it to the host system. If the desired data is not stored in the sector buffer, the HDC reads the desired data from the disk, stores it into the sector buffer, and transfers it from the sector buffer to the host system. The host system processes the desired data (so as to display images represented by the data). Until the host system receives all desired data, it keeps issuing the read command repeatedly and processing the parts of the desired data, as is illustrated in FIG. 22C.
During the data-reading operation, a read error may occur while the head (i.e., read head) is reading data from the disk. In this case, the head reads again the data recorded from that sector of the disk, where the read error has taken place. (Namely, read retry is carried out.) The read retry is repeated a predetermined number of times (e.g., at most 30 times). Therefore, it usually takes much time to read the data from the sector where the read error has occurred.
The process of transferring data, in which the read retry must be performed, will be explained with reference to FIGS. 23A to 23C. Assume that the host system issues a read command at time IS0 as is shown in FIG. 23A. In response to the read command the HDC starts transferring data at time TS1, as is illustrated in FIG. 23B.
The data which the host system has requested for is not stored in the sector buffer, and the data may therefore be read from the disk. Assume that an error occurs in, for example, the second sector of the disk during the data-reading operation, and that data is read from the disk after the read retry has been repeated 30 times at each sector of the disk. Then, the transfer of data is interrupted for a period 220 as shown in FIG. 23B, between the time the first data is transferred in response to the read command issued at time IS0 and the next data 221 is transferred.
In the HDD, once the first read retry has failed at any sector of the disk, the second read retry cannot be effected until the disk rotates about 360xc2x0 when that sector moves again to the read head. Assume that the disk is rotating at 4200 rpm, and that the host system issues a read command at intervals T of 50 ms. Hence, about 42 ms is required to perform the read retry 30 times at the sector where the read error has occurred. This period of time is shorter than the command-issuing interval T (50 ms). Should a read error take place at another sector, another 42 ms period is required for the read try.
If read errors take place at two sectors, the first read command issued at time IS0 is not performed at time IS1 when the host system must issue the second read command. In other words, the HDD has not transferred the data 221 to the host system in response to the first read command, even at time IS1 when the host system needs to issue the second read command. Hence, the host system cannot issue the second read command at time IS1. At time IS1 at which the host system should issue the second read command, the host system is processing the data the HDD transferred in response to the first read command, as is illustrated in FIG. 23C. After the host system finishes processing the data, it will process no data for periods 222 and 223. This is because it has not issue the second read command to the HDD and, hence, the HDD cannot read data to transfer to the host system. Such interruption of data processing in the host system takes place particularly when the host system processes video data that must be processed continuously.
As described above, when a read error occurs while the HDD is transferring data to the host system in response to the read commands issued by the host system has at regular intervals, the transfer of the data is interrupted. Consequently, the data processing in the host system is interrupted, and the data output from the host system is incomplete if the data processed by the host system is continuous data, such as a stream of images. In short, the conventional HDD requires much more time to perform a command when an error (particularly, a read error) occurs than when no errors occur at all.
To solve this problem, a system has been proposed which limits the time the HDD needs to transfer files from the HDD to the host system, thereby to minimizing the delay in the data processing performed in the host system. In this system, it is the host system that limits the time. However, the host system cannot accomplish normal data processing even if the time the HDD requires to perform a command is shortened.
The object of the present invention is to a disk drive which can perform a command issued by a host system before the host system issue the next command, thereby enabling the host system to effect normal data processing.
According to an aspect of the invention, there is provided a magnetic disk drive which reads data from, and writes data on, a disk in accordance with commands issued from a host system. The disk drive comprises means for setting command control information that limits the time for performing a command, and control means for controlling the process of performing the command, in accordance with the command control information, within the period between the time when the host system issued the command and the time when the host system will issues the next command.
More precisely, the command control information defines the average data transfer speed calculated from the amount of data transferred as the command is performed. The control means controls the process of performing the command, thereby to transfer data at a speed equal to or lower than the average data transfer speed.
The command control information also defines an upper limit of the time for performing the command, which is based on the amount of data transferred as the command is performed. The control means controls the process of performing a plurality of commands continuously, thereby to finish performing each command within the upper limit of the time for performing the command.
Further, the control means can supplies an error message to the host system if the process of performing any command does not complete within the period between the time when the host system issued the command and the time when the host system will issues the next command.
According to another aspect of the invention, there is provided a magnetic disk drive which reads data from, and writes data on, a disk in accordance with commands issued from a host system, and which performs read retry when a read error occurs while data is being read from the disk. This disk drive comprises means for limiting the number of times the read retry can be repeated when a command cannot be performed within the period between the time when the host system issued the command and the time when the host system will issues the next command.
With the present invention it is possible to finish transferring data to the host system, within a period between the issuance of one command and the issuance of the next command. Therefore, the host system can receive continuous data such as video data, without interruption, and can therefore reproduce data within a predetermined time.
Additional objects and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objects and advantages of the invention may be realized and obtained by means of the instrumentalities and combinations particularly pointed out hereinafter.